﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using DevExpress.Web.ASPxEditors;

public partial class AreaInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Frame.Global.GlobalFunctions.SetGridView(gridView, true);
    }
    protected void gridView_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e)
    {
        if (e.Column.FieldName == "cqbh")
        {
            if (e.Value == null)
            {
                using (DAL.DataClassesDataContext db = new DataClassesDataContext())
                {
                    int number = db.css_cqxx.Count() + 1;
                    (e.Editor as ASPxTextBox).Text = WebUtility.GenerateCode(number.ToString(), '0', 4);
                }
            }
        }
    }
}